#ifndef QQ_EMOJI_VIEW
#define QQ_EMOJI_VIEW

#include <qdialog.h>
#include <qfiledialog.h>
#include <qheaderview.h>
#include <qpainter.h>
#include <qproxystyle.h>
#include <qstackedlayout.h>
#include <qstandarditemmodel.h>
#include <qstyle.h>
#include <qstyleoption.h>

#include <ElaAppBar.h>
#include <ElaPushButton.h>
#include <ElaListView.h>
#include <ElaToolBar.h>

#include "chat/QQEmojiDelegate.h"
#include "chat/QQEmojiModel.h"

class QQEmojiStyleProxy : public QProxyStyle
{
public:
	QQEmojiStyleProxy(QStyle* style = nullptr);
	void drawPrimitive(PrimitiveElement element, const QStyleOption* option, QPainter* painter, const QWidget* widget = nullptr) const override;
};

class QQEmojiView :public QDialog
{
	Q_OBJECT
public:
	QQEmojiView(QWidget* parent = nullptr);
	~QQEmojiView();
	void setHaveLoaded(bool loaded);
	bool getHaveLoaded() const;
	void setEmojiSize(QSize size);
	void appendEmojiOnView(int index, const QQChatEmoji& emoji);
	void appendEmojiTable(const QList<QQChatEmoji>& emojis);
signals:
	void appendEmoji(const QString& filename);
	void sendEmoji(const QString& emoji, int type);
protected:
	Q_TAKEOVER_NATIVEEVENT_H
private slots:
	void doToolBarClick(QAction* action);
	void doEmojiClick(const QModelIndex& index);

private:
	int mEmojiRowCount = 10;
	bool mHaveLoaded = false;
	ElaAppBar* mAppBar;
	ElaToolBar* mToolBar;
	QList<QQEmojiStyleProxy*> mStyles;
	QList<QQEmojiModel*> mModels;
};

#endif // !QQ_EMOJI_VIEW